<template>
	<section>
		<!--start  面包屑-->
		<div class="location">
			<el-breadcrumb separator="/">
				<el-breadcrumb-item :to="{path:'/index'}">首页</el-breadcrumb-item>
				<el-breadcrumb-item>商城</el-breadcrumb-item>
				<el-breadcrumb-item>站点列表</el-breadcrumb-item>
			</el-breadcrumb>
		</div>
		<!--start content-->
		<div class="content" id="content">
			<div class="web_list" v-for="(item,index) in portalWebsiteData.list">
				<h2 class="web-title">{{item.websiteName}}</h2>
				<p class="web-row"><span>推荐模板</span></p>
				<p class="web-row">{{item.websiteWebUrl}}</p>
				<div class="web-button">
					<el-button class="fl" type="primary" style="margin-left: 0!important;" @click="goWebsite_editBtn(item,index)">编辑</el-button>
					<a class="web-a" style="cursor:pointer;" @click="showQrData" >扫码登录</a>
					<br />

				</div>
				<div class="content" style=" text-align:left" v-if="qrcodeUrl">
						<qrcode :value="item.websiteWebUrl" v-if="item.websiteWebUrl" :options="{ size: 100 }">
						</qrcode>
					</div>
			</div>

		</div>
	</section>
</template>
<script>
	import qrcode from 'vue-qrcode';
	export default {
		components: { qrcode },
		data() {
			return {
				qrcodeUrl:false,
				portalWebsiteData: { //获取站点列表信息
					"list": [],
				},
			}
		},
		methods: {
			//进入页面获取PC端数据
			queryInfo() {
				this.axios({
					method: "POST",
					url: "/v3/portal/websites/listAll",
					data: {}
				}).then((res) => {
					this.portalWebsiteData.list = res.data.list;
				}).catch((err) => {
					this.Public.openError(this, err.response.data);
				});
			},
			showQrData(){
				this.qrcodeUrl = !this.qrcodeUrl;
			},
			//跳转编辑页面
			goWebsite_editBtn(item, index) {
				localStorage.setItem("websiteCode", item.websiteCode);
				if(item.websiteCode == "00000001") {
					this.$router.push({ path: "/portalWebsite/portalPage" });
				} else {
					this.$router.push({ path: "/portalWebsite/portalPageWx" });
				}
			},

		},

		created() {
			this.queryInfo();
		},

		mounted() {
			// 设置窗口高度 start
			var winHieg = document.documentElement.clientHeight;
			var cont = document.getElementById("content");
			cont.style.height = winHieg - 115 + "px";
		},

	}
</script>
<style scoped>
	.web-a {
		width:66px;
		height: 25px;
		line-height: 25px;
		text-align: center;
		display: block;
		margin-left: 20px;
		float: left;
		background: #13C19F;
		color: white;
	}

	.web-row span {
		color: black;
		margin-right: 100px;
	}

	.web-button {
		margin-top: 10px;
		overflow: hidden;
	}

	.web-row {
		height: 26px;
		line-height: 26px;
	}

	.web-title {
		font-weight: normal;
		height: 40px;
		line-height: 40px;
		font-size: 14px;
		border-bottom: 1px #dddddd solid;
		margin-bottom: 10px;
	}

	.web_list {
		margin-bottom: 30px;
	}

	.location {
		padding: 3px 0 15px 0;
	}

	.content {
		background: #fff;
		padding: 15px;
		overflow-y: auto;
		font-family: "微软雅黑";
		position: relative;
	}
</style>
